<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>

    </style>
</head>

<body>

    <script>
        // 2，找出一个数组中所有的质数。
        var arr = [2, 3, 5, 62, 98, 157, 191];
        function zhiShu(a) {
            if (a <= 1) {
                return false;
            } else {
                for(var i=2;i<a;i++){
                    if(a%i == 0){
                        return false;
                    }
                }
            }
        }
        
        for(var i=0;i<arr.length;i++){
            var count = zhiShu(arr[i]);
            if(count != false){
                document.write(arr[i]+' ');
            }
        }
    </script>
</body>
<ml>